From: Debian Qt/KDE Maintainers Date: Sat, 27 Dec 2025 14:09:34 +0000 (+0100) Subject: upstream_llvm21 X-Git-Tag: archive/raspbian/6.10.2-2+rpi1~1^2~2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com//%22mailto:mocancezar%40gmail.com/%22/%22http:/www.example.com/%22mailto:mocancezar%40gmail.com/%22?a=commitdiff_plain;h=5de34348d6549d5e949c7395c05426c98df7c7e3;p=qt6-tools.git upstream_llvm21 Gbp-Pq: Name upstream_llvm21.diff --- diff --git a/.cmake.conf b/.cmake.conf index ce79f79..d0cc09e 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -3,7 +3,7 @@ set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1") set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1") set(QDOC_MINIMUM_CLANG_VERSION "17") set(QDOC_SUPPORTED_CLANG_VERSIONS - "20.1" "19.1" "18.1" "17.0" + "21.1" "20.1" "19.1" "18.1" "17.0" ) list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1") list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1") diff --git a/src/linguist/lupdate/clangtoolastreader.cpp b/src/linguist/lupdate/clangtoolastreader.cpp index 3db9e0d..eeab438 100644 --- a/src/linguist/lupdate/clangtoolastreader.cpp +++ b/src/linguist/lupdate/clangtoolastreader.cpp @@ -734,9 +734,25 @@ void LupdateVisitor::processPreprocessorCalls() || fileNameRealPath.str() == m_inputFile) continue; +#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(21,0,0)) + auto sourceFile = sourceMgr.getFileManager() + .getFileRef(fileNameRealPath); + if (!sourceFile) + continue; + auto sourceLocation = sourceMgr.translateFileLineCol(&sourceFile->getFileEntry(), 1, 1); +#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0)) + auto sourceFile = sourceMgr.getFileManager() + .getOptionalFileRef(fileNameRealPath); + if (!sourceFile) + continue; + auto sourceLocation = sourceMgr.translateFileLineCol(&sourceFile->getFileEntry(), 1, 1); +#else auto sourceFile = sourceMgr.getFileManager() .getFile(fileNameRealPath); + if (!sourceFile) + continue; auto sourceLocation = sourceMgr.translateFileLineCol(sourceFile.get(), 1, 1); +#endif const clang::FileID fileId = sourceMgr.getDecomposedLoc(sourceLocation).first; processIsolatedComments(fileId); } diff --git a/src/linguist/lupdate/cpp_clang.h b/src/linguist/lupdate/cpp_clang.h index 12c6611..43a1c78 100644 --- a/src/linguist/lupdate/cpp_clang.h +++ b/src/linguist/lupdate/cpp_clang.h @@ -150,14 +150,30 @@ struct TranslationRelatedStore clang::SourceLocation callLocation(const clang::SourceManager &sourceManager) { if (sourceLocation.isInvalid()) { +#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(21,0,0)) + auto sourceFile = sourceManager.getFileManager() + .getFileRef(lupdateLocationFile.toStdString()); + if (sourceFile) + sourceLocation = sourceManager.translateFileLineCol(&sourceFile->getFileEntry(), + lupdateLocationLine, locationCol); +#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0)) + auto sourceFile = sourceManager.getFileManager() + .getOptionalFileRef(lupdateLocationFile.toStdString()); + if (sourceFile) + sourceLocation = sourceManager.translateFileLineCol(&sourceFile->getFileEntry(), + lupdateLocationLine, locationCol); +#else auto sourceFile = sourceManager.getFileManager() .getFile(lupdateLocationFile.toStdString()); #if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(10,0,0)) - sourceLocation = sourceManager.translateFileLineCol(sourceFile.get(), - lupdateLocationLine, locationCol); + if (sourceFile) + sourceLocation = sourceManager.translateFileLineCol(sourceFile.get(), + lupdateLocationLine, locationCol); #else - sourceLocation = sourceManager.translateFileLineCol(sourceFile, lupdateLocationLine, - locationCol); + if (sourceFile) + sourceLocation = sourceManager.translateFileLineCol(sourceFile, lupdateLocationLine, + locationCol); +#endif #endif } return sourceLocation; diff --git a/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h b/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h index 29a9250..9778599 100644 --- a/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h +++ b/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h @@ -25,6 +25,7 @@ QT_WARNING_DISABLE_MSVC(4267) #include "clang/AST/DeclarationName.h" #include "clang/AST/GlobalDecl.h" #include "clang/AST/Mangle.h" +#include "clang/Basic/Version.h" QT_WARNING_POP @@ -160,9 +161,15 @@ static inline const Type *getFullyQualifiedTemplateType(const ASTContext &Ctx, // If a fully qualified arg is different from the unqualified arg, // allocate new type in the AST. if (MightHaveChanged) { +#if CLANG_VERSION_MAJOR >= 21 + QualType QT = Ctx.getTemplateSpecializationType( + TST->getTemplateName(), FQArgs, /*CanonicalArgs=*/{}, + TST->getCanonicalTypeInternal()); +#else QualType QT = Ctx.getTemplateSpecializationType( TST->getTemplateName(), FQArgs, TST->getCanonicalTypeInternal()); +#endif // getTemplateSpecializationType returns a fully qualified // version of the specialization itself, so no need to qualify // it. @@ -192,9 +199,15 @@ static inline const Type *getFullyQualifiedTemplateType(const ASTContext &Ctx, // allocate new type in the AST. if (MightHaveChanged) { TemplateName TN(TSTDecl->getSpecializedTemplate()); +#if CLANG_VERSION_MAJOR >= 21 + QualType QT = Ctx.getTemplateSpecializationType( + TN, FQArgs, /*CanonicalArgs=*/{}, + TSTRecord->getCanonicalTypeInternal()); +#else QualType QT = Ctx.getTemplateSpecializationType( TN, FQArgs, TSTRecord->getCanonicalTypeInternal()); +#endif // getTemplateSpecializationType returns a fully qualified // version of the specialization itself, so no need to qualify // it. @@ -257,7 +270,10 @@ static inline NestedNameSpecifier *getFullyQualifiedNestedNameSpecifier( Ctx, Scope->getPrefix(), WithGlobalNsPrefix); case NestedNameSpecifier::Super: case NestedNameSpecifier::TypeSpec: - case NestedNameSpecifier::TypeSpecWithTemplate: { +#if CLANG_VERSION_MAJOR < 21 + case NestedNameSpecifier::TypeSpecWithTemplate: +#endif + { const Type *Type = Scope->getAsType(); // Find decl context. const TagDecl *TD = nullptr; @@ -369,7 +385,10 @@ inline NestedNameSpecifier *createNestedNameSpecifier(const ASTContext &Ctx, return NestedNameSpecifier::Create( Ctx, createOuterNNS(Ctx, TD, FullyQualify, WithGlobalNsPrefix), - false /*No TemplateKeyword*/, TypePtr); +#if CLANG_VERSION_MAJOR < 21 + false /*No TemplateKeyword*/, +#endif + TypePtr); } /// Return the fully qualified type, including fully-qualified @@ -393,9 +412,13 @@ inline QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, Qualifiers Quals = QT.getQualifiers(); // Fully qualify the pointee and class types. QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix); +#if CLANG_VERSION_MAJOR >= 21 + QT = Ctx.getMemberPointerType(QT, MPT->getQualifier(), MPT->getMostRecentCXXRecordDecl()); +#else QualType Class = getFullyQualifiedType(QualType(MPT->getClass(), 0), Ctx, WithGlobalNsPrefix); QT = Ctx.getMemberPointerType(QT, Class.getTypePtr()); +#endif // Add back the qualifiers. QT = Ctx.getQualifiedType(QT, Quals); return QT;